home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.tip.net!dataphone!newsmaster
- From: skorpio@dataphone.se (Jarmo Paavilainen)
- Newsgroups: comp.lang.c
- Subject: Unable to use 'delete' after 'new'
- Date: 23 Mar 1996 09:38:03 GMT
- Organization: Dataphone Communication Networks
- Message-ID: <4j0gpr$5u6@nic.dataphone.se>
- References: <4iudtl$eni@lisa.iosphere.net>
- Reply-To: skorpio@dataphone.se
- NNTP-Posting-Host: nikson.dataphone.se
- X-Newsreader: NeoLogic News for OS/2 [version: 4.5 YO Beta]
-
- In message <4iudtl$eni@lisa.iosphere.net> - ianq@sonetis.com (Ian V.
- Quickmire) writes:
-
- ..
- :>The trick here is that I need to return this array to the calling
- function,
- :>which then processes the data.
- ..
-
- In C++ this should work.
-
- void MakeArray(int *&array)
- {
- array = new int[length];
- }
-
- /*
- or should it be
- void MakeArray(int &*array)
-
- BUT
-
- void MakeArray(int *array)
-
- Will not give any compile errors but it will not transfer the pointer.
- */
-
- main()
- {
- int *array;
-
- MakeArray(array);
- delete[] array;
-
- return 0;
- }
-
- Take care,
- Skorpio
- _________________________________________________________________________
- Jarmo Paavilainen, Skorpio skorpio@dataphone.se
- Sweden http://www.dataphone.se/~skorpio
-
-